@import "normalize.css";
@import "./variable";
@import "./components";
@import "./nodes";
@import "./highlight";

/*基础画布区域*/
.ding-flow_canvas {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.ding-flow_root {
  position: absolute;
  transform-origin: 0 0;
}
.ding-flow_breadcrumbs {
  position: absolute;
  left: 20px;
  top: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  .ding-flow_breadcrumb-item {
    line-height: 24px;
  }
  .ding-flow_breadcrumb-item-tag {
    font-size: 20px;
    padding: 0 8px;
  }
  .ding-flow_breadcrumb-item-label {
    cursor: pointer;
    color: var(--color-primary-light-4);
    &.breadcrumb-item_is-disabled {
      cursor: not-allowed;
      color: var(--color-primary-light-2);
    }
  }
}
.ding-flow_root-bg {
  position: absolute;
  left: 0;
  right: 0;
  width: 10000px;
  height: 10000px;
  transform-origin: 0 0;
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
}
.ding-flow_wrapper {
  width: 100%;
  overflow: visible;
  box-sizing: border-box;
  pointer-events: none;
}
.ding-flow_container {
  display: flex;
  width: max-content;
  height: max-content;
  padding: var(--common-padding-4);
  overflow: auto;
  box-sizing: border-box;
  align-items: center;
  min-width: 100%;
}
.ding-flow_flex-safe {
  display: flex;
  max-width: 100%;
  max-height: 100%;
}
.ding-flow_container.ding-flow_vertical {
  flex-direction: column;
  .ding-flow_flex-safe {
    flex-direction: column;
  }
}
.ding-flow_container.ding-flow-horizontal {
  flex-direction: row;
  .ding-flow_flex-safe {
    flex-direction: row;
  }
}

body[arco-theme='dark'] .ding-panel {
  .ding-panel_header {
    background-color: var(--color-bg-1);
  }
  .toggle-btn {
    background-color: var(--color-bg-2);
  }
}
.ding-panel {
  width: 0;
  position: relative;
  border-left: 4px var(--color-border-2) solid;
  box-sizing: border-box;
  z-index: 1;
  transition: all ease 0.24s;
  &.opened {
    width: 28vw;
    min-width: 460px;
    max-width: 560px;
    .toggle-btn .arco-icon {
      transform: rotate(180deg) scaleY(1.5);
    }
  }

  .toggle-btn {
    width: 20px;
    height: 64px;
    position: absolute;
    z-index: 10;
    left: -4px;
    top: 50%;
    transform: translate(-100%, -50%);
    cursor: pointer;
    border-radius: 8px 0 0 8px;
    color: var(--color-text-2);
    background-color: #f5f5f7;
    border-top: 1px solid var(--color-border-2);
    border-left: 1px solid var(--color-border-2);
    border-bottom: 1px solid var(--color-border-2);
    box-shadow: -2px 0 6px 0 var(--shadow2-center);
    text-align: center;
    line-height: 64px;
    .arco-icon {
      transition: all ease 0.24s;
      transform: scaleY(1.5);
    }
  }

  .ding-panel_header,
  .ding-panel_body {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
  }
  .ding-panel_header {
    top: 0;
    height: 50px;
    overflow: hidden;
    display: flex;
    align-items: center;
    color: var(--color-text-1);
    background-color: #f5f5f7;;
    z-index: 20;
    box-sizing: border-box;
    padding: 0 16px;
    font-size: 18px;
    font-weight: bolder;
    .bpmn-icon {
      width: 30px;
      height: 30px;
    }
  }
  .ding-panel_body {
    top: 50px;
    bottom: 0;
    overflow-y: auto;
  }
}

/*流程节点通用*/
.flow-node {
  border-radius: var(--border-radius-medium);
  //border: 1px solid var(--color-border-3);
  position: relative;
  background-color: var(--color-bg-4);
  z-index: 10;
  transition: var(--transision);
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1490196078);
  &:hover {
    > .flow-node__remove {
      visibility: visible;
      opacity: 1;
    }
  }
}
.flow-node__wrapper {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  position: relative;
  .flow-node__container {
    position: relative;
  }
  .flow-node__container.flow-node__movable {
    cursor: move;
  }
  .flow-node__container.flow-node__uncompleted {
    .flow-node {
      //box-shadow: 0 0 10px 0 var(--color-danger-light-4);
    }
  }
  .node-tag-icon {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #ffffff;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: all ease 0.24s;
    &.node__uncompleted-tag {
      left: 0;
      top: 0;
      background-color: rgb(var(--danger-6));
      transform: translate(-50%, -50%);
    }
    &.node__default-flow-tag {
      right: 0;
      top: 0;
      background-color: rgb(var(--success-6));
      transform: translate(50%, -50%) scale(0.8);
    }
    &.node__delete-tag {
      right: 0;
      top: 0;
      color: rgb(var(--orange-10));
      z-index: 15;
      opacity: 0;
    }
  }
  &:hover > .flow-node__container {
     & > .node-tag-icon.node__delete-tag {
      cursor: pointer;
      opacity: 1;
    }
  }
}
.flow-node__behavior {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  pointer-events: auto;
  &::before,
  &::after {
    content: '';
  }
  .flow-node__behavior-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: pointer;
    &.flow-node__droppable {
      background-color: rgb(var(--success-8));
    }
    &.flow-node__not-droppable {
      background-color: rgb(var(--danger-8));
    }
  }
}
.node-behavior__header {
  font-size: 16px;
}
.node-behavior__btn-grid {
  display: grid;
  gap: 8px 20px;
  margin-top: 10px;
  grid-template-columns: repeat(2, 1fr);
  color: var(--color-text-2);
}
.node-behavior__btn {
  cursor: pointer;
  display: flex;
  padding: 8px;
  min-width: 120px;
  border-radius: 10px;
  position: relative;
  color: var(--color-text-1);
  background-color: var(--color-fill-2);
  border-color: transparent;
  align-items: center;
  justify-content: center;
  .node-behavior__btn-text {
    flex: 1;
  }
}
.ding-flow_container.ding-flow_vertical {
  .flow-node__wrapper {
    flex-direction: column;
  }
  .flow-node__behavior {
    height: 100px;
    width: 2px;
    &.small-behavior {
      height: 40px;
    }
    &::before {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      background-color: var(--color-line);
    }
    &::after {
      position: absolute;
      bottom: -1px;
      left: 0;
      right: 0;
      border-top: 10px solid var(--color-line);
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      transform: translateX(-5px);
    }
  }
}
.ding-flow_container.ding-flow_horizontal {
  .flow-node__wrapper {
    flex-direction: row;
  }
  .flow-node__behavior {
    width: 100px;
    height: 2px;
    &.small-behavior {
      width: 40px;
    }
    &::before {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      background-color: var(--color-line);
    }
    &::after {
      position: absolute;
      right: -1px;
      top: 0;
      bottom: 0;
      border-left: 10px solid var(--color-line);
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
      transform: translateY(-5px);
    }
  }
}
.flow-node_header {
  width: 100%;
  height: auto;
  padding: var(--common-padding-1) var(--common-padding-2);
  color: var(--color-text-1);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--common-padding-2);
  > span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
  }
}
.flow-node_content {
  height: auto;
  display: flex;
  align-items: center;
  font-size: 0.8em;
  line-height: 1.5em;
  padding: var(--common-padding-2);
  color: var(--color-text-3);
}
